import TencentRequest from "@/driver/TencentRequest"

const ApiTencentSSL = {
    /**
     * 获取证书列表.
     * @param account {Object}
     * @param queryParam {Object|null}
     * @param callback {Function}
     * @param failCallback {Function}
     */
    getSSLList(account, queryParam, callback, failCallback) {
        TencentRequest.request('', account, 'ssl', 'DescribeCertificates', queryParam, callback, failCallback)
    },
    /**
     * 下载证书.
     * @param certificateId {String}
     * @param account {Object}
     * @param callback {Function}
     * @param failCallback {Function}
     */
    down(certificateId, account, callback, failCallback) {
        TencentRequest.request('', account, 'ssl', 'DownloadCertificate', {CertificateId: certificateId}, callback, failCallback)
    },
    /**
     * 删除证书.
     * @param certificateId {string}
     * @param account {Object}
     * @param callback {Function}
     * @param failCallback {Function}
     */
    del(certificateId, account, callback, failCallback) {
        TencentRequest.request('', account, 'ssl', 'DeleteCertificate', {CertificateId: certificateId}, callback, failCallback)
    },
    /**
     * 免费申请证书.
     * @param domainName {String}
     * @param account {Object}
     * @param callback {Function}
     * @param failCallback {Function}
     */
    freeApply(domainName, account, callback, failCallback) {
        TencentRequest.request('', account, 'ssl', 'ApplyCertificate', {
            DomainName: domainName,
            DvAuthMethod: 'DNS_AUTO',
        }, callback, failCallback)
    }
}

export default ApiTencentSSL
